package com.jy.adscm.security.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.util.AntPathMatcher;

/**
 * @author yyy
 * @ClassName AdscmSecurityConfig
 * @Description 权限相关所有配置
 * @date 2018/7/26 15:49
 */
@Configuration
public class AdscmSecurityConfig  {




    /**
     * 密码加密类
     * @return
     */
    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    /**
     * Spring 的工具类，做URI匹配的，匹配规则如下：
     *  1. ？ 匹配一个字符
     *  2. *  匹配0个或多个字符
     *  3. ** 匹配0个或多个目录
     */
    @Bean
    @Scope("prototype")
    public AntPathMatcher antPathMatcher(){
        return  new AntPathMatcher();
    }
}
